package com.ipzoe.web.core.config;

import com.ipzoe.web.token.JwtAuthorizationTokenFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean<JwtAuthorizationTokenFilter> jwtAuthorizationTokenFilterRegistrationBean(JwtAuthorizationTokenFilter jwtAuthorizationTokenFilter) {
        FilterRegistrationBean<JwtAuthorizationTokenFilter> filterRegistrationBean =
                new FilterRegistrationBean<JwtAuthorizationTokenFilter>(jwtAuthorizationTokenFilter);
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setOrder(0);
        return filterRegistrationBean;
    }

}
